﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace gChartSharp
{
    public class SimpleEncoder : IEncoder
    {
        private static readonly char[] c_encodingValues = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".ToCharArray();

        public string Encode(float num)
        {
            int number = Convert.ToInt32(num);

            if (number < 0 || number > 61)
                throw new EncoderException("SimpleEncoder can only encode numbers between 0 and 61.");

            return c_encodingValues[number].ToString();
        }
    }
}
